<?php


namespace api\channel\meituan\alliance;


use api\channel\ExtendChannleBase;
use app\model\BaseSupplier;
use think\Exception;

abstract class MeituanAllianceBase extends ExtendChannleBase
{

    public function __construct($serv_type = PRODUCT_SECKILL_SERV, $code ='')
    {
        $meituan = BaseSupplier::where('code', $code)
            ->where('serv_type',$serv_type)
            ->find();

        if (!$meituan) {
            throw new Exception('不存在配置信息');
        }
        if (empty($meituan->api_config['apikey'])) {
            throw new Exception('缺少配置信息');
        }

        $this->supplierInfo = $meituan;

        $this->apikey = $meituan->api_config['apikey'];
    }


    abstract public function orders($params);
}